//
//  HomeHeaderCollectionViewCell.m
//  BaseFrame
//
//  Created by 孟学浩 on 2017/4/1.
//  Copyright © 2017年 com.mxh. All rights reserved.
//

#import "HomeHeaderCollectionViewCell.h"

@interface HomeHeaderCollectionViewCell()

@property (nonatomic,strong) UIImageView *imgView;
@property (nonatomic,strong) UILabel *titleLabel;

@end

@implementation HomeHeaderCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        
        _imgView = [UIImageView new];
        _imgView.contentMode = 1;
        _imgView.backgroundColor = getColor(@"f1f2f6");
        _imgView.layer.masksToBounds = YES;
        
        _titleLabel = [UILabel new];
        _titleLabel.font = DEF_FontSize_12;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        
        [self.contentView addSubview:_imgView];
        [self.contentView addSubview:_titleLabel];
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    _imgView.frame = CGRectMake(0, 0, 36/WIDTH_5S_SCALE, 36/WIDTH_5S_SCALE);
    _imgView.center = CGPointMake(self.width/2., self.height/2.-10);
    _imgView.layer.cornerRadius = 18/WIDTH_5S_SCALE;
    
    _titleLabel.frame = CGRectMake(0, CGRectGetMaxY(_imgView.frame), self.frame.size.width, 30);
}

- (void)setDataDictionary:(NSDictionary *)dataDictionary{
    _dataDictionary = dataDictionary;
    _titleLabel.text = _dataDictionary[@"title"];
    _imgView.image = [UIImage imageNamed:_dataDictionary[@"img"]];
}



@end
